package org.czl.LeetCode;

public class l1343 {
    public int numOfSubarrays(int[] arr, int k, int threshold) {
        int ans = 0;
        int n = arr.length;
        int sum = 0;
        for(int i = 0; i < n; i++){
            sum += arr[i];
            if(i < k - 1){
                continue;
            }
            double t = (double)sum/k;
            if(t >= threshold)ans++;
            sum -= arr[i - k + 1];
        }
        return  ans;
    }
}
